home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: novice.uwaterloo.ca!mkalisia
- From: mkalisia@novice.uwaterloo.ca (Maciej Kalisiak)
- Subject: casting virtual base classpointer to derived
- Sender: news@novice.uwaterloo.ca (Mr. News)
- Message-ID: <DLE98M.nEI@novice.uwaterloo.ca>
- Date: Thu, 18 Jan 1996 20:36:22 GMT
- Nntp-Posting-Host: novice.uwaterloo.ca
- Organization: University of Waterloo
-
- I ran into a "limitation" of C++ that I wasn't aware off, and I was
- hoping someone out there can tell me how to get around this
- limitation:
-
- I have a base class Base. I derive a number of other classes from Base
- using "virtual public". I have an array/list of Base*, which holds
- pointers to a whole bunch of object of type Base, or any of the derived
- ones. I take one of these pointers (Base*) and I know that it was
- really pointing to a derived class. I try to cast to this derived class
- but I can't (supposedly all compilers are supposed to issue an error in
- such a case).
-
- Any ideas of how to keep such a list of derived type objets using
- Base*'s, or how to get around this ???
-
- I am using Watcom v10.0
-
-